package com.lzh.walletdemo.mapper;

import com.lzh.walletdemo.entity.LogAmount;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.transaction.annotation.Transactional;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

@Mapper
public interface UserOperationMapper {
    //查询用户钱包余额
    public BigDecimal getBalance(Integer userId);
    //用户消费100元
    public int pay(Map<Object,Object> map);
    //用户退款20元
    public int balanceBack(Map<Object,Object> map);
    //查询用户钱包金额变动明细
    public List<LogAmount> getAmountLog(Integer userId);
    //用户消费或者退款时,在明细表里记录其金额
    @Transactional
    public void recordLog(LogAmount logAmount);
}
